<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>concat()函数</title>
</head>
<body>
    <script>
        var str1 = "hello";
        var str2 = "world";
        var str3 = "!!!!!";
        //concat()函数:连接字符串，不常用，平常用+相接
        document.write(''.concat(str1,str2,str3),"<br>");
        document.write(str1+str2+str3,"<br>");//常用

        //concat和+的区别
        //  concat不管什么类型直接合成字符串，
        //  +遇到数字类型直接做运算，遇到字符串和再合成
        var str4 = 1;
        var str5 = 2;
        var str6 = 3;
        var str7 = "abc";
        document.write(''.concat(str4,str5,str6),"<br>");
        document.write(str4+str5+str6,"<br>");
        document.write(str4+str5+str6+str7,"<br>");
    </script>
</body>
</html>